package com.liuyz.demo2;

public class 匿名内部类 {

    public static void main(String[] args) {
        CellPhone cellPhone = new CellPhone();

        cellPhone.alarm(() -> System.out.println("下课！"));

        cellPhone.alarm(
                () -> System.out.println("上课了！")
        );
    }

}

interface Bell {
    void ring();
}

class CellPhone {
    public void alarm(Bell bell) {
        bell.ring();
    }
}